import sys
import os
import requests

# sys.path.append("..")
# sys.path.append("../utils")
# os.environ.update({"DJANGO_SETTINGS_MODULE": "server.settings"})
# django.setup()
# from django.test import Client

# client = Client()

baseUrl = u"http://127.0.0.1:8000/api/log/"

# baseUrl = u"http://192.168.10.3:8000/api/storehouse/"


def getIPList():
    iputData = {
        'page':'1',
        'maxItem' : '15',        
        "token":"61aa3da28253d3877c20",   
    }
    res = requests.post(baseUrl + 'ipadmin/', data=iputData)
    print(res.content)

def IPLogScreen():
    iputData = {
        'page':'1',
        'maxItem' : '15',   
        'warZoneId' : '1',
        'companyId' : '',
        'username' : '', 
        'usertype' : 2,               
        "token":"24af9e53417b3d766552",   
    }
    res = requests.post(baseUrl + 'ipscreen/', data=iputData)
    print(res.content)

def getLog():
    iputData = {
        'page':'1',
        'maxItem' : '15',   
        'logType' : 0,               
        "token":"f89263c5c6ca57861247",   
    }
    res = requests.post(baseUrl + 'list/', data=iputData)
    print(res.content)


def logScreen():
    iputData = {
        'page':'1',
        'maxItem' : '15',   
        'startDate' : '2020-03-25',
        'endDate' : '2020-04-23',
        'name' : 'uu', 
        'logType' : 1,               
        "token":"61aa3da28253d3877c20",   
    }
    res = requests.post(baseUrl + 'screen/', data=iputData)
    print(res.content)

def logCheck():
    iputData = {
        'page':'1',
        'maxItem' : '20',   
        'id' : '4', 
        'logType' : 0,               
        "token":"61aa3da28253d3877c20",   
    }
    res = requests.post(baseUrl + 'check/', data=iputData)
    print(res.content)

if __name__ == '__main__':
    getIPList()
    # IPLogScreen()
    # getLog()
    # logScreen()
    # logCheck()

